import 'package:base_plugin/base_plugin.dart';
import 'package:finance_app/src/common/app_colors.dart';
import 'package:finance_app/src/utils/cash_utils.dart';
import 'package:finance_app/src/widgets/common/tag_widget.dart';
import 'package:finance_app/src/widgets/select/mixin/check_box_mixin.dart';
import 'package:finance_app/src/widgets/wrapper/normal_form_wrapper.dart';
import 'package:flutter/material.dart';

class PayslipsItemCheckBox extends StatelessWidget with CheckBoxMixin {
  final String name;
  final String timeRange;
  final String status;
  final String currency;
  final num amount;
  final bool isSelect;
  final bool isEnable;

  const PayslipsItemCheckBox(
      {Key key,
      this.name,
      this.isSelect,
      this.isEnable = true,
      this.timeRange,
      this.status,
      this.currency,
      this.amount})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return NormalFormWrapper(
      leftPadding: getDp(35),
      rightPadding: getDp(35),
      topPadding: getDp(24),
      bottomPadding: getDp(23),
      hasBottomBorder: true,
      backgroundColor: isSelect ? aceLightBlue : null,
      child: Row(
        children: [
          buildSelectWidget,
          SizedBox(
            width: getDp(15),
          ),
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  name,
                  style: TextStyle(
                    color: aceBlackColor,
                    fontSize: getSp(18),
                    fontWeight: FontWeight.w700,
                    height: 14 / 18,
                  ),
                ),
                SizedBox(
                  height: getDp(8),
                ),
                Text(
                  timeRange,
                  style: TextStyle(
                    color: aceBlackColor,
                    fontSize: getSp(14),
                    fontWeight: FontWeight.w400,
                    height: 14 / 14,
                  ),
                ),
              ],
            ),
          ),
          Column(
            crossAxisAlignment: CrossAxisAlignment.end,
            children: [
              if (status != null)
                RedTagWidget(
                  content: status,
                ),
              SizedBox(
                height: getDp(6),
              ),
              Text(
                '$currency ${CashUtils.formatCashAmount(amount)}',
                style: TextStyle(
                  color: aceBlackColor,
                  fontSize: getSp(16),
                  fontWeight: FontWeight.w700,
                  height: 14 / 16,
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
